Skip to content

feat: enforce max-redirects and response-size limit on crawler (#1816)#2000

Open
Rafiaminhaj wants to merge 2 commits into
utksh1:mainfrom
Rafiaminhaj:feature/crawler-limits-1816
Open

feat: enforce max-redirects and response-size limit on crawler (#1816)#2000
Rafiaminhaj wants to merge 2 commits into
utksh1:mainfrom
Rafiaminhaj:feature/crawler-limits-1816

Conversation

@Rafiaminhaj

Copy link
Copy Markdown
Collaborator

Description

Resolves #1816 by implementing configurable limits for maximum redirects and maximum response size in the crawler backend.

Changes Made

  • Added max_redirects (default 10) and max_size (default 5MB) parameters to the crawl_target function.
  • Switched request model from client.get to client.stream("GET", url) for chunked stream validation.
  • Implemented proactive size checks on the Content-Length header (if present).
  • Implemented cumulative download size validation across stream chunks to terminate responses exceeding max_size.
  • Added a dedicated unit test suite in testing/backend/unit/test_crawler_limits.py testing redirect limits, content-length limits, and streaming chunk boundaries. All 88 tests pass successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#43] crawler has no max-redirects or response-size cap

1 participant